package com.samplecompany.gui;

import org.apache.wicket.Component;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;

/**
 * Homepage
 */
public abstract class StyledMenuPanel extends Panel implements ITabbedPanelTarget {
	/** */
	private static final long serialVersionUID = 1L;
	private final MashupPanel menuTabsContainer;
	private final TabbedPanelTab firstTab;
	private Panel selectedTab;
	
	/**
	 * 
	 */
	public StyledMenuPanel(String id) {
		super(id);
		add(menuTabsContainer = new MashupPanel("mashup-menu-container-id"));
		{
			menuTabsContainer.add(firstTab = new TabbedPanelTab(this, Model.of("First"), FirstPanel.class));
			menuTabsContainer.add(new TabbedPanelTab(this, Model.of("Second"), SecondPanel.class));
			menuTabsContainer.add(new TabbedPanelTab(this, Model.of("Third"), ThirdPanel.class));
		}
		
		firstTab.select();
	}

	public Component getSelectedTab() {
		return selectedTab;
	}

	public void setSelectedTabAndPanel(Panel selectedTab, Panel newInstance) {
		this.selectedTab = selectedTab;
		setSelectedTabPanelContent(newInstance);
	}
	
	/**
	 * @param newInstance
	 */
	public abstract void setSelectedTabPanelContent(Panel newInstance);
}